﻿<html>
<body>
<script type="text/javascript" src="/site_media/js/lib/jquery.js"></script>
<script type="text/javascript" src="/site_media/js/lib/jquery.blockUI.js"></script>

<script type="text/javascript">
$(document).ready(function() { 

}); 

function save(){
	$("#i_loading").ajaxStart(function(){
		$('#i_loading').block({ message: 'saving...' }); 
	});
	var local = window.top.location.protocol+'//'+window.top.location.host+'/';
	var comment_id = Math.random() * 100000;
	var requesturl = local + 'demo/update_ajax/save/';
	
	var name = $('#name')[0].value;
	var msn = $('#msn')[0].value;
	var friend_id = $('#friendid')[0].value;

	$.post(requesturl, {  
		name:name,
		msn:msn,
		friend_id:friend_id,
		comment_id:comment_id
		}, function(result){
			if(result.toString()=='true'){
				$('#i_loading').block({ message: '加载信息成功' });
				$('#i_loading').unblock();
			}else{ 
				$('#i_loading').block({ message: '加载信息失败' });
			}
		},'json' ); 
}
</script> 
	<h2>Create or Edit New Friends</h2>
	<div id='i_loading'>
		<input type='hidden' id='friendid' name='friendid' value='{{friend.key.id}}'>
		<table>
			<tr>
				<td>
					Name:<input type='text' id='name' name='name' value='{{friend.name}}'>
				</td>
			</tr>
			<tr>
				<td>
					msn:<input type='text' id='msn' name='msn' value='{{friend.msn}}'>
				</td>
			</tr>
			<tr>
				<td>
					<input type="button" value="Create or Edit Friend" onClick="save();">
				</td>
			</tr>
		</table>
	</div>
</body>
</html>
